# -*- coding:utf-8 -*-

import smtplib  
from email.mime.text import MIMEText  


mail_host="smtp.sina.cn"  
mail_user="cm_ha_jh@sina.cn"   
mail_pass="helloworld"   


def send_mail(to_list,sub,content):  
	me="jhjk"+"<"+mail_user+">"  
	msg = MIMEText(content,_subtype='plain',_charset='gb2312')  
	msg['Subject'] = sub  
	msg['From'] = me  
	msg['To'] = ";".join(to_list)
	try:  
		
		server = smtplib.SMTP(mail_host,timeout=30)
		server.set_debuglevel(1)
		server.ehlo()
		server.starttls()
		server.login(mail_user,mail_pass)  
		server.sendmail(me, to_list, msg.as_string())  
		server.close()
		return True
	except Exception, e:
		print str(e)
		return False
